<template>
  <view class="gf_goods_content">
    <view class="head">
      <text class="title">店铺热卖</text>
      <view class="change" @click="rotateImage">
        <!--        <image :style="{transform : 'rotate(' + angle + 'deg)', transitionDuration: 3 + 's'}"-->
        <!--               :src="BaseImgUrl + '/guanfan/detail/refresh.png'"></image>-->
        <text>查看更多</text>
        <u-icon name="arrow-right" color="#888888"></u-icon>
        <!-- #ifdef H5 -->
        <wx-open-launch-weapp id="launch-btn"
                              :username="getBuToPagePath(1)"
                              :path="shop?.actionUrl?.wxPath ? shop?.actionUrl?.wxPath : shop?.action_url?.wx_mini.mt.path"
                              style="position: absolute;z-index: 2;left: 0;width: 100%;height:100%;opacity: 0.01;background-color: #ff531a">
          <component :is="'script'" type='text/wxtag-template' style="display: block;">
            <div style="position: absolute;top: 0; left: 0; width: 100%;height: 100% ; opacity: 0"></div>
          </component>
        </wx-open-launch-weapp>
        <!-- #endif -->
      </view>
    </view>
    <view class="goods_content">
      <view class="goods" v-for="(goodsItem,index) in goods.slice(0, 3)" :key="index">
        <image :src="goodsItem.picUrl"></image>
        <view class="name"> {{ goodsItem.name }}</view>
        <view>
          <text class="price">￥{{ goodsItem.actPrice }}</text>
          <text class="line_price">￥{{ goodsItem.oriPrice }}</text>
        </view>
      </view>
    </view>
  </view>

  <u-popup
    :show="isShowChoose"
    :round="10"
    mode="bottom"
    @close="isShowChoose = false"
    closeable
  >
    <view class="pop-root">
      <view class="box-title">商品列表</view>
      <view class="box-title-line"></view>
      <view class="baocuan-wrao">
        <view class="bgTitle-box">
          <scroll-view scroll-y="true" style="height: 100%;padding-bottom: 30rpx">
            <view class="goods_content1">
              <view class="goodsList" v-for="(goodsItem,index) in goods" :key="index">
                <view class="goodsImg">
                  <image class="goodsImg" :src="goodsItem.picUrl"></image>
                </view>
                <view style="margin-left: 10rpx">
                  <view class="name"> {{ goodsItem.name }}</view>
                  <view class="sell"> 月销量：{{ goodsItem.monthSaleNum }}</view>
                  <view>
                    <text class="price">￥{{ goodsItem.actPrice }}</text>
                    <text class="line_price">￥{{ goodsItem.oriPrice }}</text>
                  </view>
                </view>
              </view>
            </view>
          </scroll-view>
        </view>
      </view>
    </view>
  </u-popup>
</template>
<script setup>
import {ref, onMounted} from "vue";
import {getBuToPagePath, toMiniAppBusiness} from "../../utils/utils";

const props = defineProps({
  goods: {
    type: Array,
  },
  shop: {
    type: Object,
  },
})
const emits = defineEmits(['goMeiTuanShop'])
onMounted(() => {
  console.log('shopGF', props.shop)
})
const angle = ref(0)
const isShowChoose = ref(false)
const rotateImage = () => {
  toMiniAppBusiness(1, props.shop?.actionUrl?.wxPath)
  /* angle.value += 2880
  isShowChoose.value = true */
  // emits('goMeiTuanShop', 0)
}
</script>
<style scoped lang="scss">
.gf_goods_content {
  background-color: #FFFFFF;
  margin: 0 30rpx 20rpx;
  border-radius: 20rpx;
  padding: 20rpx;

  .head {
    display: flex;
    height: 50rpx;
    line-height: 50rpx;
    font-size: 30rpx;

    .change {
      display: flex;
      font-size: 26rpx;
      color: #888888;
      align-items: center;
      position: relative;
      image {
        margin-right: 6rpx;
        width: 32rpx;
        height: 32rpx;
      }
    }

    .title {
      flex: 1;
    }
  }
}

.goods_content {
  margin-top: 20rpx;
  display: flex;

  .goods {
    width: 210rpx;
    padding: 0 6rpx;
    margin-right: 13rpx;
    background-color: #FAFAFA;
    border-radius: 10rpx;
  }

  image {
    width: 200rpx;
    height: 200rpx;
    border: #333333 1rpx dot-dash;
    border-radius: 8rpx;
  }

  .name {
    color: #171717;
    font-size: 24rpx;
    margin: 10rpx 0 6rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }

  .price {
    color: #FE5414;
    font-size: 28rpx;
  }

  .line_price {
    margin-left: 10rpx;
    color: #B8B8B8;
    font-size: 26rpx;
    text-decoration: line-through;
  }
}

.goods_content1 {
  margin-top: 20rpx;
  height: 880rpx;

  .goods {
    width: 200rpx;
  }

  image {
    border: #333333 1rpx dot-dash;
    border-radius: 8rpx;
  }

  .name {
    color: #171717;
    font-weight: bold;
    font-size: 28rpx;
    margin: 10rpx 0 6rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }
  .sell{
    color: #999999;
    font-size: 24rpx;
    margin: 10rpx 0 10rpx;
  }
  .price {
    color: #FE5414;
    font-size: 28rpx;
    font-weight: bold;
  }

  .line_price {
    margin-left: 10rpx;
    color: #B8B8B8;
    font-size: 26rpx;
    text-decoration: line-through;
  }

  .goodsList {
    display: flex;
    margin-bottom: 26rpx;
    margin-right: 20rpx;
    margin-left: 20rpx;
    height: 168rpx;

    .goodsImg{
      background-color: #999999;
      width: 168rpx;
      height: 168rpx;
      border: #333333 1rpx dot-dash;
      border-radius: 8rpx;
    }
  }
}

.pop-root {
  height: 888rpx;

  .bgTitle-box {
    height: 818rpx;
  }
}

.box-title {
  font-weight: bold;
  font-size: 18px;
  margin: auto 0;
  padding: 8px 30rpx;
  border-radius: 20rpx 20rpx 0 0;
  background: #fff;
}

.box-title-line {
  height: 2rpx;
  background-color: #F6F6F6;
}

</style>
